{include file="common:meta" /}

<title>转盘管理 - 转盘类目 - TXCMS_V2</title>
<meta name="keywords" content="">
<meta name="description" content="">
{load href="__STATIC__/admin/layui/dist/css/layui.css"}
</head>
<body>
{include file="common:header" /}

{include file="common:menu" /}

<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> <a href="{:url('index/index')}">首页</a>
        <span class="c-gray en">&gt;</span>
        转盘管理
        <span class="c-gray en">&gt;</span>
        转盘类目 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a> </nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <table class="table table-border table-bordered table-bg">
                <thead>
                <tr>
                    <th scope="col" colspan="9">转盘列表</th>
                </tr>
                <tr class="text-c">
                    <th width="40">转盘ID</th>
                    <th width="80">转盘名称</th>
                    <th width="30">所需经验</th>
                    <th width="30">状态</th>
                    <th width="30">操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="data" id="vo"}
                <tr class="text-c" style="height: 10px;">
                    <td>{$vo.id}</td>
                    <td>{$vo.lottery_name}</td>
                    <td>{$vo.req_exp}</td>
                    <td style="width: 40px;">
                        <form class="layui-form">
                            <div class="layui-form-item">
                                <div class="layui-input-block" style="margin-left: 0">
                                    <input type="checkbox" lay-skin="switch" {$vo.status ? "checked=''": ""} lay-filter="switch" data-url="{:url('lottery/changeShow',array('id'=>$vo['id']))}" lay-text="开|关">
                                </div>
                            </div>
                        </form>
                    </td>
                    <td>
                        <a href="javascript:;" onClick="lottery_edit('编辑','/admin.php/admin/lottery/lottery_edit?id={$vo.id}','4','','400')" class="ml-5 btn btn-success-outline radius size-MINI" style="text-decoration:none">编辑</a>
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
            <div style="float: right"></div>

        </article>
    </div>
</section>
{load href="__STATIC__/admin/layui/dist/layui.all.js"}
{include file="common:footer" /}

<!--请在下方写此页面业务相关的脚本-->
{load href="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"}
{load href="__STATIC__/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"}
{load href="__STATIC__/admin/lib/laypage/1.2/laypage.js"}
<script type="text/javascript">
    /*删除*/
    function member_del(id){
        $.post("{:url('IpWhitelist/delete')}",{'id':id},function (res) {
            if(res.code===0){
                layer.msg(res.msg,{icon:2});
            }else{
                layer.msg(res.msg,{icon:1});
                setTimeout(function () {window.location.reload()},2000)
            }
        })
    }

    /*管理员-角色-编辑*/
    function lottery_edit(title,url,id,w,h){
        layer_show(title,url,w,h);
    }

    layui.use('form', function(){
        var form = layui.form;
        form.on('switch(switch)', function(data) {
            var url = $(this).data('url');
            var status = data.elem.checked;//开关是否开启，true或者false
            //后台我需要的是0或1，所以预先在js中处理change的值
            if(status) {
                status = 1;
            } else {
                status = 0;
            }
            $.post(url, {status: status}, function(res) {
                if(res.code) {
                    layer.msg(res.msg);
                }
            });
        });
    });

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>